//
//  UIView+ZXFrame.m
//  XIMaLaYaFM
//
//  Created by fanzhuxian on 2017/8/26.
//  Copyright © 2017年 FanZhuxian. All rights reserved.
//

#import "UIView+ZXFrame.h"

@implementation UIView (ZXFrame)

- (void)setZx_width:(CGFloat)zx_width {
    
    CGRect rect = self.frame;
    rect.size.width = zx_width;
    self.frame = rect;
}

- (CGFloat)zx_width {
    
    return self.frame.size.width;
}

- (void)setZx_height:(CGFloat)zx_height {
    
    CGRect rect = self.frame;
    rect.size.height = zx_height;
    self.frame = rect;
}

- (CGFloat)zx_height {
    
    return self.frame.size.height;
}

- (void)setZx_x:(CGFloat)zx_x {
    
    CGRect rect = self.frame;
    rect.origin.x = zx_x;
    self.frame = rect;
}

- (CGFloat)zx_x {
    
    return self.frame.origin.x;
}

- (void)setZx_y:(CGFloat)zx_y {
    
    CGRect rect = self.frame;
    rect.origin.y = zx_y;
    self.frame = rect;
}

- (CGFloat)zx_y {
    
    return self.frame.origin.y;
}

#pragma mark centerX
- (void)setZx_centerX:(CGFloat)zx_centerX {
    
    CGPoint center = self.center;
    center.x = zx_centerX;
    self.center = center;
    
}

- (CGFloat)zx_centerX {
    
    return self.center.x;
}

#pragma mark centerY
- (void)setZx_centerY:(CGFloat)zx_centerY {
    
    CGPoint center = self.center;
    center.y = zx_centerY;
    self.center = center;
    
}

- (CGFloat)zx_centerY {
    
    return self.center.y;
}

@end
